/*  build-in.c - dgsh - shell like bash
 * Autor        Diego Gomes da Silva    nUSP 7656467
 *              Alfredo Lima Porfirio   nUSP 7236614
 * Sistemas Operacionais 2
 * Professor Monaco
 * ICMC/USP
 */
#include <build-in.h>
int exec_built_in (  ControlDgsh * controlDgsh, int a  )
{
        if ( !strcmp ( controlDgsh->command[a][0], "exit" ) ) {
        controlDgsh->continuous=0;
        return 1;
    }
        if ( !strcmp ( controlDgsh->command[a][0], "help" ) ) {
        printf ( "Help: famous Beattles song ... \n" );
        return 1;
    }
        if ( !strcmp ( controlDgsh->command[a][0], "cd" ) ) {
        
            if (chdir(controlDgsh->command[a][1]) == -1) {
       perror("chDir error");
    }
        return 1;
    }
    return 0;
}
